<?php
/**
 * 公告板
 * @author Administrator
 *
 */
class announcement extends CControllerOwnerBase{
	

	public function show()
	{
		$newsModel = new newsModel();
		$pageIndex = $this->getRequestData("page","GET",1);
		$pageSize = 10;
		$c = 0;
		
		$list = $newsModel->selectPage($pageIndex,$pageSize,"news_id,title,to_char(pub_time,'yyyy/mm/dd') as pub_time","del_flag=0","sort_num desc,pub_time desc","",$c);
		$pageStr = CPage::showPage($pageIndex,$pageSize,$c);
		$this->render("an_list",array("newsList"=>$list,"pageStr"=>$pageStr));
	}
	
	public function detail()
	{
		$id = $this->getRequestData("id","get",0);
		
		$newsModel = new newsModel();
		
		$newsInfo = $newsModel->selectById($id,"del_flag=0","news_id,title,to_char(pub_time,'yyyy/mm/dd') as pub_time,content");
		
		$isExist = 1;
		if(!$newsInfo)
		{
			$isExist = 0;
		}
		else{
			$newsInfo["content"] = stripslashes($newsInfo['content']);
		}
		$this->render("an_detail",array("modelInfo"=>$newsInfo,"isExist"=>$isExist));
	}
	
}